////////////////////order script////////////////////////////////


function initOrder(){
	
	var sortfield = $("#sortfield").val();
	var sorttype = $("#sorttype").val();
	
	if(sorttype == "" || sorttype == "null"){
		setAscOrder();
	}else{
		
		if(sorttype == "asc"){
			setCss(sortfield,"eaoa-sort-desc");
			setDescOrder()
		}else{
			setCss(sortfield,"eaoa-sort-asc");
			setAscOrder();
		}
	}
}



function orderData(sortfield,sorttype){

	$("#sortfield").attr("value",sortfield);
	$("#sorttype").attr("value",sorttype);

	Search();
}

/**
 * ��DESC�����¼�
 */
function setDescOrder(){

	$(".oaorder").each(function(){
		$(this).click(function(){
			var sortfield = $(this).attr("id");
		    orderData(sortfield,'desc');
		    
		});
	});
}

/**
 * ��ASC�����¼�
 */
function setAscOrder(){

	$(".oaorder").each(function(){
		$(this).click(function(){
			var sortfield = $(this).attr("id");
			 orderData(sortfield,'asc');
		    
		});
	});
}

/**
 * �趨��Ҫ�������ͷ��ʽ
 */
function setCss(id,css){
	
	var spanid = id.replace("\.","\\.");
	var objSpan = $("#"+spanid+"_icon");
	objSpan.removeClass(); 
	objSpan.addClass(css);

	var objTd = $("#"+id);
	objTd.removeClass("oaorder-this"); 
	objTd.addClass("oaorder-this");
	
	
}


 
